ByVal Keyword

Used to pass a parameter by value.

ByVal parameter

PartTypeDescription
parameter Any Data Type Parameter to be passed by value.


Notes

ByVal can be used in the Method Declaration area to denote that a parameter is to be passed by value. By default, parameters are passed by value. Therefore, the ByVal keyword is optional.

Parameters passed by value are treated as local variables inside the method--just like variables that are created using the Dim statement. This means that you can modify the values of the parameters themselves rather than first assigning the parameter to a local variable. For example, if you pass a value in the parameter "x", you can increment or decrement the value of x rather then assigning the value of x to a local variable that is created using Dim.


See Also

ByRef keyword.